﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;

namespace LMSStatisticsService
{
    public partial class LMSStats : ServiceBase
    {
        public Thread MonThread;
        private Monitor Mon;

        public LMSStats()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            Mon = new Monitor();
            MonThread = new Thread(Mon.Run) {Priority = ThreadPriority.Lowest};
            MonThread.SetApartmentState(ApartmentState.MTA);
            MonThread.Start();
        }

        protected override void OnStop()
        {
            Mon.Stop();
            MonThread.Abort();
        }
    }
}
